package com.iims.project.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.iims.common.core.domain.BaseEntity;
import com.iims.common.core.domain.BussinessEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import javax.validation.constraints.Size;
import java.util.Date;

/**
 * @TableName cmis_work_token
 */
@ApiModel("工作令")
@TableName(value = "cmis_work_token")
@Data
@BussinessEntity
public class CmisWorkToken extends BaseEntity {
    /**
     *
     */
    @ApiModelProperty("工作令Id")
    @TableId(type = IdType.AUTO)
    private Long workTokenId;

    /**
     * 项目Id
     */
    @ApiModelProperty(value = "项目Id", required = true)
    @Positive(message = "正式合同Id必须有效 >0")
    private Long proId;

    /**
     * 订单id
     */
    @ApiModelProperty("订单id,可为空，不关联订单")
    private Long orderId = 0L;


    /**
     * 工作令编号
     */
    @ApiModelProperty("工作令编号，自生成")
    private String workTokenCode;

    /**
     * 工作令名(作令内容)
     */
    @ApiModelProperty(value = "工作令名(作令内容)", required = true)
    @NotBlank(message = "工作令名，max=255个字符")
    @Size(max = 255, message = "工作令名不能大于255个字符")
    private String workContent;

    /**
     * 产品id
     */
    @ApiModelProperty(value = "产品Id", required = true)
    @Positive(message = "产品Id必须有效 >0")
    private Integer productId;


    /**
     * 产品数量
     */
    @ApiModelProperty(value = "产品数量", required = true)
    @Positive(message = "产品数量必须有效 >0")
    private Integer count;

    /**
     * 管理类型
     */
    @ApiModelProperty(value = "管理类型:值来源于字典business_workToken_manageType", required = true)
    private Integer manageType;

    /**
     * 责任部门
     */
    @ApiModelProperty(value = "责任部门", required = true)
    @Positive(message = "责任部门有效 >0")
    private Integer deptCharge;

    /**
     * 负责人-user_code
     */
    @ApiModelProperty(value = "负责人(user_code)", required = true)
    @NotBlank(message = "负责人不能为空")
    private String userCharge;

    /**
     * 研制方式
     */
    @ApiModelProperty("研制方式,值来源于字典business_workToken_researchType")
    private Integer researchType;

    /**
     * 计划编号
     */
    @ApiModelProperty("计划编号")
    private String planCode;

    @ApiModelProperty(value = "要求交期|yyyy-MM-dd", required = true)
    @NotNull(message = "要求交期时间不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date deliveryDate;

    /**
     * 计划完成日期
     */
    @ApiModelProperty(value = "计划完成日期|yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date planCompleteTime;

    /**
     * 实际完成日期
     */
    @ApiModelProperty(value = "实际完成日期|yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date reallyCompleteTime;

    /**
     * 执行状态
     */
    @ApiModelProperty("执行状态,值来源于字典business_workToken_exeStatus")
    private Integer exeStatus;

    /**
     * 归集状态
     */
    @ApiModelProperty(value = "归集状态,值来源于字典business_common_collectStatus", hidden = true)
    private Integer collectionStatus;


    /**
     * 业务类别
     */
    @ApiModelProperty(value = "业务类别,值来源于字典business_common_businessType,默认值为订单的业务类别值，若未关联订单，则此需要用户选择录入", required = true)
    private Integer businessType;

    /**
     * 产品频段
     */
    @ApiModelProperty(value = "产品频段,值来源于business_common_productBandType,默认值为订单的产品频段，若未关联订单，则此需要用户选择录入", required = true)
    @Positive(message = "产品频段必须有效")
    private Integer productBandType;


    //VO
    @ApiModelProperty("责任人(中文)")
    @TableField(exist = false)
    private String userChargeCN;

    @ApiModelProperty("责任部门(中文)")
    @TableField(exist = false)
    private String deptChargeCN;
}